<?php

class AjaxGetController extends Controller{

	public function actionHotelMsg($id, $arriveTime, $leaveTime, $num) {
		$model = Hotel::model()->findByPk($_GET['id']);
		$diffTime = strtotime($leaveTime) - strtotime($arriveTime);
		$days = floor($diffTime / (3600 * 24))-1 < 0 ? 0 : floor($diffTime / (3600 * 24))-1;
		$table = '<table>';
		for ($i=0; $i<=$days; $i++) {
			$time = date('Y-m-d', strtotime("+$i day", strtotime($arriveTime)));
			$price = $model->timePriceObjAttr('price_dealer', $time);
			$table .= "
			<tr>
				<td width='200px'>{$time}</td>
				<td class='font-clr bh-font24 bh-strong hotel-price' price='{$price}'><span class='bh-font12'>¥</span>{$price}x{$num}</td>
			</tr>
			";
		}
		$table .= '</table>';
		echo $table;
	}
}

?>